package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SysAttachCate;
import com.ruoyi.system.mapper.SysAttachCateMapper;
import com.ruoyi.system.service.ISysAttachCateService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 素材分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-10
 */
@Service
public class SysAttachCateServiceImpl implements ISysAttachCateService 
{
    @Resource
    private SysAttachCateMapper sysAttachCateMapper;

    /**
     * 查询素材分类
     * 
     * @param id 素材分类主键
     * @return 素材分类
     */
    @Override
    public SysAttachCate selectSysAttachCateById(Long id)
    {
        return sysAttachCateMapper.selectSysAttachCateById(id);
    }

    /**
     * 查询素材分类列表
     * 
     * @param sysAttachCate 素材分类
     * @return 素材分类
     */
    @Override
    public List<SysAttachCate> selectSysAttachCateList(SysAttachCate sysAttachCate)
    {
        return sysAttachCateMapper.selectSysAttachCateList(sysAttachCate);
    }

    /**
     * 新增素材分类
     * 
     * @param sysAttachCate 素材分类
     * @return 结果
     */
    @Override
    public int insertSysAttachCate(SysAttachCate sysAttachCate)
    {
        sysAttachCate.setCreateTime(DateUtils.getNowDate());
        return sysAttachCateMapper.insertSysAttachCate(sysAttachCate);
    }

    /**
     * 修改素材分类
     * 
     * @param sysAttachCate 素材分类
     * @return 结果
     */
    @Override
    public int updateSysAttachCate(SysAttachCate sysAttachCate)
    {
        sysAttachCate.setUpdateTime(DateUtils.getNowDate());
        return sysAttachCateMapper.updateSysAttachCate(sysAttachCate);
    }

    /**
     * 批量删除素材分类
     * 
     * @param ids 需要删除的素材分类主键
     * @return 结果
     */
    @Override
    public int deleteSysAttachCateByIds(Long[] ids)
    {
        return sysAttachCateMapper.deleteSysAttachCateByIds(ids);
    }

    /**
     * 删除素材分类信息
     * 
     * @param id 素材分类主键
     * @return 结果
     */
    @Override
    public int deleteSysAttachCateById(Long id)
    {
        return sysAttachCateMapper.deleteSysAttachCateById(id);
    }
}
